package com.wao.information.service.dto;


import com.fasterxml.jackson.annotation.JsonFormat;

import javax.persistence.Lob;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.time.Instant;
import java.time.ZonedDateTime;
import java.util.Objects;

/**
 * A DTO for the Information entity.
 */
public class InformationDTO implements Serializable {

    private Long id;

    @NotNull
    private String name;

    private String viceTitle;

    private String image;

    @Size(max = 2000)
    private String description;

    @Lob
    private String content;

    private String keywords;

    private Integer visits;

    private String source;

    private String author;

    @NotNull
    private Boolean enabled;

    private Integer displayOrder;

    @Size(max = 8)
    private String langKey;

    @NotNull
    private Long categoryId;

    private Instant createdDate;

    private ZonedDateTime publishDate;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getViceTitle() {
        return viceTitle;
    }

    public void setViceTitle(String viceTitle) {
        this.viceTitle = viceTitle;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getKeywords() {
        return keywords;
    }

    public void setKeywords(String keywords) {
        this.keywords = keywords;
    }

    public Integer getVisits() {
        return visits;
    }

    public void setVisits(Integer visits) {
        this.visits = visits;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public Boolean isEnabled() {
        return enabled;
    }

    public void setEnabled(Boolean enabled) {
        this.enabled = enabled;
    }

    public Integer getDisplayOrder() {
        return displayOrder;
    }

    public void setDisplayOrder(Integer displayOrder) {
        this.displayOrder = displayOrder;
    }

    public String getLangKey() {
        return langKey;
    }

    public void setLangKey(String langKey) {
        this.langKey = langKey;
    }

    public Long getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(Long categoryId) {
        this.categoryId = categoryId;
    }

    @JsonFormat(shape = JsonFormat.Shape.STRING)
    public Instant getCreatedDate() {
        return createdDate;
    }

    public void setCreatedDate(Instant createdDate) {
        this.createdDate = createdDate;
    }

    @JsonFormat(shape = JsonFormat.Shape.STRING)
    public ZonedDateTime getPublishDate() {
        return publishDate;
    }

    public void setPublishDate(ZonedDateTime publishDate) {
        this.publishDate = publishDate;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        InformationDTO informationDTO = (InformationDTO) o;
        if (informationDTO.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), informationDTO.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getId());
    }

    @Override
    public String toString() {
        return "InformationDTO{" +
                "id=" + getId() +
                ", name='" + getName() + "'" +
                ", viceTitle='" + getViceTitle() + "'" +
                ", image='" + getImage() + "'" +
                ", description='" + getDescription() + "'" +
                ", content='" + getContent() + "'" +
                ", keywords='" + getKeywords() + "'" +
                ", visits='" + getVisits() + "'" +
                ", source='" + getSource() + "'" +
                ", author='" + getAuthor() + "'" +
                ", enabled='" + isEnabled() + "'" +
                ", displayOrder='" + getDisplayOrder() + "'" +
                ", langKey='" + getLangKey() + "'" +
                ", categoryId='" + getCategoryId() + "'" +
                ", publishDate='" + getPublishDate() + "'" +
                "}";
    }
}
